package cn.itcast.cmf.service;

import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import cn.itcast.crm.domain.Customer;

public interface CustomerService {
	// 查找为关联的客户
	@Path("/noassociation")
	@GET
	@Produces({ "application/xml", "application/json" })
	public List<Customer> findNoAssociationCustomers();

	// 查找关联的客户
	@Path("/association/{fixedAreaId}")
	@GET
	@Consumes({ "application/xml", "application/json" })
	@Produces({ "application/xml", "application/json" })
	public List<Customer> findAssociationCustomers(@PathParam("fixedAreaId") String fixedAreaId);

	// 将未关联的添加到已经关联的
	@Path("/toFixedArea")
	@PUT
	public void associationCustomerToFixedArea(@QueryParam("fixedAreaId") String fixedAreaId,
			@QueryParam("customerId") String customerId);

	@Path("/customer")
	@POST
	@Consumes({ "application/xml", "application/json" })
	public void regist(Customer customer);
	
	//通过telephone找到一个customer对象
	@Path("/customer/telephone/{telephone}")
	@GET
	@Consumes({ "application/xml", "application/json" })
	public Customer findByTelephone(@PathParam("telephone") String telephone);
	
	//修改对象里的类型
	@Path("/customer/updatetype/{telephone}")
	@PUT
	@Consumes({ "application/xml", "application/json" })
	public void updateType(@PathParam("telephone") String telephone);
	
	@Path("customer/login")
	@GET
	@Consumes({"application/xml" , "application/json"})
	public Customer login(@QueryParam("telephone") String telephone,
			@QueryParam("password") String password);
	
	
	@Path("/customer/findFixedAreaIdByAddress")
	@GET
	@Consumes({"application/json","application/xml"})
	public String findFixedAreaIdByAddress(@QueryParam("address") String address);
	
}
